﻿using System;

namespace VASJ.Provider
{
    public class AcpInetPermisionProvider : BaseHelper
    {
        /// <summary>
        /// SetPermissionForUser
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="projectId"></param>
        /// <param name="permissionName"></param>
        /// <returns></returns>
        public bool SetPermissionForUser(string userName, int projectId, string permissionName)
        {
            return this.GetService().SetPermissionForUser(this._ApplicationName, userName, projectId, permissionName);
        }

        /// <summary>
        /// SetPermissionForUser
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="projectId"></param>
        /// <param name="permissionName"></param>
        /// <returns></returns>
        public bool SetPermissionForUser(string userName, int projectId, string[] permissionName)
        {
            return this.GetService().SetPermissionsForUser(this._ApplicationName, userName, projectId, permissionName);
        }

        /// <summary>
        /// SynchPermissionType
        /// </summary>
        /// <param name="permissionName"></param>
        /// <returns></returns>
        public bool SynchPermissionType(string[] permissionName)
        {
            return this.GetService().SynchPermissionType(this._ApplicationName, permissionName);
        }

        /// <summary>
        /// GrantPermissionForRole
        /// </summary>
        /// <param name="roleName"></param>
        /// <param name="permissionName"></param>
        /// <param name="grant"></param>
        /// <returns></returns>
        public bool GrantPermissionForRole(string roleName, string permissionName, bool grant)
        {
            return this.GetService().GrantPermissionForRole(this._ApplicationName, roleName, permissionName, grant);
        }

        /// <summary>
        /// RemovePermissionForTarget
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="projectID"></param>
        /// <param name="permissionName"></param>
        /// <returns></returns>
        public bool RemovePermissionForTarget(string userName, int projectID, string permissionName)
        {
            return this.GetService().RemovePermissionForTarget(this._ApplicationName, userName, projectID, permissionName);
        }

        /// <summary>
        /// RemovePermissionForTarget
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="projectID"></param>
        /// <param name="permissionName"></param>
        /// <returns></returns>
        public bool RemovePermissionForTarget(string userName, int projectID, string[] permissionName)
        {
            return this.GetService().RemovePermissionsForTarget(this._ApplicationName, userName, projectID, permissionName);
        }

        /// <summary>
        /// RemovePermissionForUser
        /// </summary>
        /// <param name="userName"></param>
        /// <returns></returns>
        public bool RemovePermissionForUser(string userName)
        {
            return this.GetService().RemovePermissionForUser(this._ApplicationName, userName);
        }

        /// <summary>
        /// RemovePermissionForRole
        /// </summary>
        /// <param name="roleName"></param>
        /// <returns></returns>
        public bool RemovePermissionForRole(string roleName)
        {
            return this.GetService().RemovePermissionForRole(this._ApplicationName, roleName);
        }

        /// <summary>
        /// IsGrantedUser
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="projectID"></param>
        /// <param name="permissionName"></param>
        /// <returns></returns>
        public bool IsGrantedUser(string userName, int projectID, string permissionName)
        {
            return this.GetService().IsGrantedUser(this._ApplicationName, userName, projectID, permissionName);
        }

        /// <summary>
        /// IsGrantedUser
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="projectID"></param>
        /// <param name="permissionName"></param>
        /// <returns></returns>
        public bool IsGrantedUser(string userName, int projectID, string[] permissionName)
        {
            return this.GetService().IsGrantedUser2(this._ApplicationName, userName, projectID, permissionName);
        }

        /// <summary>
        /// GetGrantedPermission
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="permissionName"></param>
        /// <returns></returns>
        public int[] GetGrantedPermission(string userName, string permissionName)
        {
            return this.GetService().GetGrantedPermission(this._ApplicationName, userName, permissionName);
        }

        /// <summary>
        /// GetGrantedPermission
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="permissionName"></param>
        /// <returns></returns>
        public int[] GetGrantedPermission(string userName, string[] permissionName)
        {
            return this.GetService().GetGrantedPermission2(this._ApplicationName, userName, permissionName);
        }

        /// <summary>
        /// GetGratedUser2
        /// </summary>
        /// <param name="projectID"></param>
        /// <param name="permissionName"></param>
        /// <returns></returns>
        public Guid[] GetGratedUser2(int projectID, string permissionName)
        {
            return this.GetService().GetGratedUser(this._ApplicationName, projectID, permissionName);
        }

        /// <summary>
        /// GetGratedUser
        /// </summary>
        /// <param name="projectID"></param>
        /// <param name="permissionName"></param>
        /// <returns></returns>
        public string[] GetGratedUser(int projectID, string permissionName)
        {
            return this.GetService().GetGratedUserName(this._ApplicationName, projectID, permissionName);
        }

        /// <summary>
        /// GetGratedUser2
        /// </summary>
        /// <param name="projectID"></param>
        /// <param name="permissionName"></param>
        /// <returns></returns>
        public Guid[] GetGratedUser2(int projectID, string[] permissionName)
        {
            return this.GetService().GetGratedUser2(this._ApplicationName, projectID, permissionName);
        }

        /// <summary>
        /// GetGratedUser
        /// </summary>
        /// <param name="projectID"></param>
        /// <param name="permissionName"></param>
        /// <returns></returns>
        public string[] GetGratedUser(int projectID, string[] permissionName)
        {
            return this.GetService().GetGratedUserName2(this._ApplicationName, projectID, permissionName);
        }

        /// <summary>
        /// GetRoleOfPermission
        /// </summary>
        /// <param name="permissionName"></param>
        /// <returns></returns>
        public string[] GetRoleOfPermission(string permissionName)
        {
            return this.GetService().GetRoleOfPermission(this._ApplicationName, permissionName);
        }

        /// <summary>
        /// GetRoleOfPermission
        /// </summary>
        /// <param name="permissionName"></param>
        /// <returns></returns>
        public string[] GetRoleOfPermission(string[] permissionName)
        {
            return this.GetService().GetRoleOfPermissions(this._ApplicationName, permissionName);
        }

        /// <summary>
        /// IsUserHasRolePermission
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="Role"></param>
        /// <param name="permissionName"></param>
        /// <returns></returns>
        public bool IsUserHasRolePermission(string userName, string[] Role, string permissionName)
        {
            return this.GetService().IsUserHasRolePermission(this._ApplicationName, userName, Role, permissionName);
        }

        /// <summary>
        /// IsUserHasRolePermission
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="Role"></param>
        /// <param name="permissionName"></param>
        /// <returns></returns>
        public bool IsUserHasRolePermission(string userName, string[] Role, string[] permissionName)
        {
            return this.GetService().IsUserHasRolePermissions(this._ApplicationName, userName, Role, permissionName);
        }

        /// <summary>
        /// GetRolePermission
        /// </summary>
        /// <param name="roleName"></param>
        /// <returns></returns>
        public string[] GetRolePermission(string roleName)
        {
            return this.GetService().GetRolePermission(this._ApplicationName, roleName);
        }

        /// <summary>
        /// GetRolePermission
        /// </summary>
        /// <param name="roleName"></param>
        /// <returns></returns>
        public string[] GetRolePermission(string[] roleName)
        {
            return this.GetService().GetRolesPermission(this._ApplicationName, roleName);
        }

        /// <summary>
        /// GetRolePermissionsForUser
        /// </summary>
        /// <param name="userName"></param>
        /// <returns></returns>
        public string[] GetRolePermissionsForUser(string userName)
        {
            return this.GetService().GetRolePermissionsForUser(this._ApplicationName, userName);
        }
    }
}